package ut;

/**
 * Some utilities to test the underlying OS.
 *
 * @author Thibault Langlois
 *
 */
public final class OsUtils {

    private static String OS = null;

    /**
     * Uses System.getProperty(os.name).
     *
     * @return a String that designates the OS name.
     */
    public static String getOsName() {
        if (OS == null) {
            OS = System.getProperty("os.name");
        }
        return OS;
    }

    /**
     * Check is OS is windows.
     *
     * @return true if OS is windows else returns false.
     */
    public static boolean isWindows() {
        return getOsName().startsWith("Windows");
    }

    /**
     * Check is OS is Linux.
     *
     * @return true if OS is Linux else returns false.
     */
    public static boolean isLinux() {
        return getOsName().startsWith("Linux");
    }
}
